{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e03bc33e",
   "metadata": {},
   "outputs": [],
   "source": [
    "p = \"data/LCCD.json\"\n",
    "import json\n",
    "\n",
    "with open(p, 'r') as f:\n",
    "    text_l = json.load(f)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b0915422",
   "metadata": {},
   "outputs": [],
   "source": [
    "totel_ = len(text_l)\n",
    "count = 40\n",
    "a_length = int(totel_/count)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "41a0f023",
   "metadata": {},
   "outputs": [],
   "source": [
    "b_list = []\n",
    "e_list = []\n",
    "for i in range(40):\n",
    "    b_ = i * a_length\n",
    "    e_ = (i+1) * a_length \n",
    "    b_list.append(b_)\n",
    "    e_list.append(e_)\n",
    "e_list[-1] = -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "0894a604",
   "metadata": {},
   "outputs": [],
   "source": [
    "for i, (b, e) in enumerate(zip(b_list, e_list)):\n",
    "    sub_texts = text_l[b: e]\n",
    "    \n",
    "    s_path = f\"data/sub_LCCD_{i+1}.json\"\n",
    "    with open(s_path, 'w') as f:\n",
    "        json.dump(sub_texts,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "fa491947",
   "metadata": {},
   "outputs": [],
   "source": [
    "p = \"data/sub_LCCD_40.json\"\n",
    "import json\n",
    "\n",
    "with open(p, 'r') as f:\n",
    "    text_l40 = json.load(f)\n",
    "    \n",
    "totel_ = len(text_l40) \n",
    "s_index = int(totel_*0.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "f0b902ec",
   "metadata": {},
   "outputs": [],
   "source": [
    "s_path = f\"data/sub_LCCD_40_1.json\"\n",
    "sub_texts = text_l[: s_index]\n",
    "with open(s_path, 'w') as f:\n",
    "    json.dump(sub_texts,f)\n",
    "    \n",
    "s_path = f\"data/sub_LCCD_40_2.json\"\n",
    "sub_texts = text_l[s_index :]\n",
    "with open(s_path, 'w') as f:\n",
    "    json.dump(sub_texts,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "1bf16c60",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "66378e82",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4ceea715",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "021a5a54",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bd012e9e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "07c3846f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
